package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpInventoryItemLookUpPageUtil extends SeleniumPageUtil {
	public final static By INVENTORY_SPAN_HEADER = By.id("ctl46_lblHdr");
	public final static By INVENTORY_TD_ITEM = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[1]");
	public final static By INVENTORY_INPUT_ITEM_ID = By.id("ctl46_txtItemID");
	public final static By INVENTORY_BUTTON_CLEAR = By.id("btnClear");
	
	// item list
	public final static By INVENTORY_TABLE_ITEM_LIST = By.xpath("//*[@id='ctl46_aceItemID_completionListElem']/table");
	
	public static void enterInventoryItemLookPage() {
		SpHomePageUtil.enter();
		SpHomePageUtil.enterInventoryItemLookPage();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				INVENTORY_SPAN_HEADER, INVENTORY_TD_ITEM, INVENTORY_INPUT_ITEM_ID, INVENTORY_BUTTON_CLEAR
			});
		
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(INVENTORY_SPAN_HEADER));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(INVENTORY_TD_ITEM));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(INVENTORY_INPUT_ITEM_ID));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(INVENTORY_BUTTON_CLEAR));
	}
}
